package com.yunlankeji.stemcells.activity.home;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.yunlankeji.ganxibaozhijia.R;
import com.yunlankeji.stemcells.activity.mine.Address_editActivity;
import com.yunlankeji.stemcells.adapter.Organization_mainAdapter;
import com.yunlankeji.stemcells.model.request.Address;
import com.yunlankeji.stemcells.model.request.Organization_menu;
import com.yunlankeji.stemcells.model.request.Organization_mian;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class Home_organization_classifyActivity extends AppCompatActivity {

    @BindView(R.id.tv_organization_name)
    TextView tv_organization_name;
    @BindView(R.id.tv_organization_fans)
    TextView tv_organization_fans;
    @BindView(R.id.iv_organization)
    TextView tv_organization;
    @BindView(R.id.tv_organization_classify_title)
    TextView tv_organization_classify_title;
    LinearLayout lt_home_organization_classify_return;

    private RecyclerView rv_organization_classify;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home_organization_classify);


        lt_home_organization_classify_return = findViewById(R.id.lt_home_organization_classify_return);
        lt_home_organization_classify_return.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        tv_organization_classify_title = findViewById(R.id.tv_organization_classify_title);


        rv_organization_classify = findViewById(R.id.rv_organization_classify);

        String tv_tilt = getIntent().getStringExtra("title");

        tv_organization_classify_title.setText(tv_tilt);

        List<Organization_mian> organization_mianList = new ArrayList<>();


        Organization_mian organization_mian1 = new Organization_mian("123","75.5W",R.mipmap.icon_p2);
        Organization_mian organization_mian2 = new Organization_mian("123","75.5W",R.mipmap.icon_p3);
        Organization_mian organization_mian3 = new Organization_mian("123","75.5W",R.mipmap.icon_p2);
        Organization_mian organization_mian4 = new Organization_mian("123","75.5W",R.mipmap.icon_p2);
        Organization_mian organization_mian5 = new Organization_mian("123","75.5W",R.mipmap.icon_p3);

        organization_mianList.add(organization_mian1);
        organization_mianList.add(organization_mian2);
        organization_mianList.add(organization_mian3);
        organization_mianList.add(organization_mian4);
        organization_mianList.add(organization_mian5);
        GridLayoutManager gridLayoutManager1 = new GridLayoutManager(Home_organization_classifyActivity.this,2);
        rv_organization_classify.setLayoutManager(gridLayoutManager1);
        Organization_mainAdapter organization_mainAdapter = new Organization_mainAdapter(organization_mianList);
        rv_organization_classify.setAdapter(organization_mainAdapter);

        organization_mainAdapter.setOnItemClickListener((Organization_mainAdapter.OnItemClickListener) MyItemClickListener2);

    }
    private Organization_mainAdapter.OnItemClickListener MyItemClickListener2 = new Organization_mainAdapter.OnItemClickListener() {
        @Override
        public void onItemClick(View v, Organization_mainAdapter.ViewName viewName, int position) {
            switch (v.getId()){

                case R.id.lt_organization:
                    startActivity(new Intent(Home_organization_classifyActivity.this, Address_editActivity.class));
                    break;
            }

        }

        @Override
        public void onItemLongClick(View v) {

        }
    };
}